CC =	cc
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O0
CPP =	cc -E
LINK =	$(CC)
AR = ar rc
ANAME = lib/liblikevent.a

ALL_INCS = -I src \
	-I src/sys \
	-I src/log \
	-I src/event
	
CORE_DEPS = src/sys/evutil.h \
	src/log/log.h \
	src/sys/queue.h \
	src/event/event.h \
	src/event/event_internal.h \
	src/event/evsignal.h
	

objs/likevent:	objs/evutil.o \
	objs/log.o \
	objs/epoll.o \
	objs/evsignal.o \
	objs/event.o

	$(AR) $(ANAME) \
	objs/evutil.o \
	objs/log.o \
	objs/epoll.o \
	objs/evsignal.o \
	objs/event.o
	ranlib $(ANAME)

	
objs/evutil.o:	$(CORE_DEPS) \
	src/sys/evutil.c
	$(CC) -c $(CFLAGS) $(ALL_INCS) $(CORE_INCS) \
		-o objs/evutil.o \
		src/sys/evutil.c
		
objs/log.o:	$(CORE_DEPS) \
	src/log/log.c
	$(CC) -c $(CFLAGS) $(ALL_INCS) $(CORE_INCS) \
		-o objs/log.o \
		src/log/log.c
		
objs/epoll.o:	$(CORE_DEPS) \
	src/os/epoll.c
	$(CC) -c $(CFLAGS) $(ALL_INCS) $(CORE_INCS) \
		-o objs/epoll.o \
		src/os/epoll.c
		
objs/evsignal.o:	$(CORE_DEPS) \
	src/event/evsignal.c
	$(CC) -c $(CFLAGS) $(ALL_INCS) $(CORE_INCS) \
		-o objs/evsignal.o \
		src/event/evsignal.c
		
objs/event.o:	$(CORE_DEPS) \
	src/event/event.c
	$(CC) -c $(CFLAGS) $(ALL_INCS) $(CORE_INCS) \
		-o objs/event.o \
		src/event/event.c

clean:
	-rm objs/*.o lib/liblikevent.a
